home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gcc_260.zip / gcc_260 / cexp.c < prev    next >
C/C++ Source or Header  |  1993-11-27  |  52KB  |  1,927 lines

  1.  
  2. /*  A Bison parser, made from cexp.y with Bison version GNU Bison version 1.22
  3.   */
  4.  
  5. #define YYBISON 1  /* Identify Bison output.  */
  6.  
  7. #define    INT    258
  8. #define    CHAR    259
  9. #define    NAME    260
  10. #define    ERROR    261
  11. #define    OR    262
  12. #define    AND    263
  13. #define    EQUAL    264
  14. #define    NOTEQUAL    265
  15. #define    LEQ    266
  16. #define    GEQ    267
  17. #define    LSH    268
  18. #define    RSH    269
  19. #define    UNARY    270
  20.  
  21. #line 26 "cexp.y"
  22.  
  23. #include "config.h"
  24. #include <setjmp.h>
  25. /* #define YYDEBUG 1 */
  26.  
  27. #ifdef MULTIBYTE_CHARS
  28. #include <stdlib.h>
  29. #include <locale.h>
  30. #endif
  31.  
  32. #include <stdio.h>
  33.  
  34. typedef unsigned char U_CHAR;
  35.  
  36. /* This is used for communicating lists of keywords with cccp.c.  */
  37. struct arglist {
  38.   struct arglist *next;
  39.   U_CHAR *name;
  40.   int length;
  41.   int argno;
  42. };
  43.  
  44. /* Define a generic NULL if one hasn't already been defined.  */
  45.  
  46. #ifndef NULL
  47. #define NULL 0
  48. #endif
  49.  
  50. #ifndef GENERIC_PTR
  51. #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
  52. #define GENERIC_PTR void *
  53. #else
  54. #define GENERIC_PTR char *
  55. #endif
  56. #endif
  57.  
  58. #ifndef NULL_PTR
  59. #define NULL_PTR ((GENERIC_PTR)0)
  60. #endif
  61.  
  62. int yylex ();
  63. void yyerror ();
  64. int expression_value;
  65.  
  66. static jmp_buf parse_return_error;
  67.  
  68. /* Nonzero means count most punctuation as part of a name.  */
  69. static int keyword_parsing = 0;
  70.  
  71. /* some external tables of character types */
  72. extern unsigned char is_idstart[], is_idchar[], is_hor_space[];
  73.  
  74. extern char *xmalloc ();
  75.  
  76. /* Flag for -pedantic.  */
  77. extern int pedantic;
  78.  
  79. /* Flag for -traditional.  */
  80. extern int traditional;
  81.  
  82. #ifndef CHAR_TYPE_SIZE
  83. #define CHAR_TYPE_SIZE BITS_PER_UNIT
  84. #endif
  85.  
  86. #ifndef INT_TYPE_SIZE
  87. #define INT_TYPE_SIZE BITS_PER_WORD
  88. #endif
  89.  
  90. #ifndef LONG_TYPE_SIZE
  91. #define LONG_TYPE_SIZE BITS_PER_WORD
  92. #endif
  93.  
  94. #ifndef WCHAR_TYPE_SIZE
  95. #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
  96. #endif
  97.  
  98. #ifndef MAX_CHAR_TYPE_SIZE
  99. #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
  100. #endif
  101.  
  102. #ifndef MAX_INT_TYPE_SIZE
  103. #define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
  104. #endif
  105.  
  106. #ifndef MAX_LONG_TYPE_SIZE
  107. #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
  108. #endif
  109.  
  110. #ifndef MAX_WCHAR_TYPE_SIZE
  111. #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
  112. #endif
  113.  
  114. /* Yield nonzero if adding two numbers with A's and B's signs can yield a
  115.    number with SUM's sign, where A, B, and SUM are all C integers.  */
  116. #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
  117.  
  118. static void integer_overflow ();
  119. static long left_shift ();
  120. static long right_shift ();
  121.  
  122. #line 127 "cexp.y"
  123. typedef union {
  124.   struct constant {long value; int unsignedp;} integer;
  125.   struct name {U_CHAR *address; int length;} name;
  126.   struct arglist *keywords;
  127.   int voidval;
  128.   char *sval;
  129. } YYSTYPE;
  130.  
  131. #ifndef YYLTYPE
  132. typedef
  133.   struct yyltype
  134.     {
  135.       int timestamp;
  136.       int first_line;
  137.       int first_column;
  138.       int last_line;
  139.       int last_column;
  140.       char *text;
  141.    }
  142.   yyltype;
  143.  
  144. #define YYLTYPE yyltype
  145. #endif
  146.  
  147. #include <stdio.h>
  148.  
  149. #ifndef __cplusplus
  150. #ifndef __STDC__
  151. #define const
  152. #endif
  153. #endif
  154.  
  155.  
  156.  
  157. #define    YYFINAL        73
  158. #define    YYFLAG        -32768
  159. #define    YYNTBASE    34
  160.  
  161. #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 39)
  162.  
  163. static const char yytranslate[] = {     0,
  164.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  165.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  166.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  167.      2,     2,    29,     2,    31,     2,    27,    14,     2,    32,
  168.     33,    25,    23,     9,    24,     2,    26,     2,     2,     2,
  169.      2,     2,     2,     2,     2,     2,     2,     8,     2,    17,
  170.      2,    18,     7,     2,     2,     2,     2,     2,     2,     2,
  171.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  172.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  173.      2,     2,     2,    13,     2,     2,     2,     2,     2,     2,
  174.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  175.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  176.      2,     2,     2,    12,     2,    30,     2,     2,     2,     2,
  177.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  178.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  179.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  180.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  181.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  182.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  183.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  184.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  185.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  186.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  187.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  188.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  189.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  190.      6,    10,    11,    15,    16,    19,    20,    21,    22,    28
  191. };
  192.  
  193. #if YYDEBUG != 0
  194. static const short yyprhs[] = {     0,
  195.      0,     2,     4,     8,    11,    14,    17,    20,    23,    24,
  196.     31,    35,    39,    43,    47,    51,    55,    59,    63,    67,
  197.     71,    75,    79,    83,    87,    91,    95,    99,   103,   107,
  198.    113,   115,   117,   119,   120,   125
  199. };
  200.  
  201. static const short yyrhs[] = {    35,
  202.      0,    36,     0,    35,     9,    36,     0,    24,    36,     0,
  203.     29,    36,     0,    23,    36,     0,    30,    36,     0,    31,
  204.      5,     0,     0,    31,     5,    37,    32,    38,    33,     0,
  205.     32,    35,    33,     0,    36,    25,    36,     0,    36,    26,
  206.     36,     0,    36,    27,    36,     0,    36,    23,    36,     0,
  207.     36,    24,    36,     0,    36,    21,    36,     0,    36,    22,
  208.     36,     0,    36,    15,    36,     0,    36,    16,    36,     0,
  209.     36,    19,    36,     0,    36,    20,    36,     0,    36,    17,
  210.     36,     0,    36,    18,    36,     0,    36,    14,    36,     0,
  211.     36,    13,    36,     0,    36,    12,    36,     0,    36,    11,
  212.     36,     0,    36,    10,    36,     0,    36,     7,    36,     8,
  213.     36,     0,     3,     0,     4,     0,     5,     0,     0,    32,
  214.     38,    33,    38,     0,     5,    38,     0
  215. };
  216.  
  217. #endif
  218.  
  219. #if YYDEBUG != 0
  220. static const short yyrline[] = { 0,
  221.    159,   164,   165,   172,   177,   180,   182,   185,   189,   191,
  222.    196,   201,   213,   228,   239,   246,   253,   259,   265,   268,
  223.    271,   277,   283,   289,   295,   298,   301,   304,   307,   310,
  224.    313,   315,   317,   322,   324,   337
  225. };
  226.  
  227. static const char * const yytname[] = {   "$","error","$illegal.","INT","CHAR",
  228. "NAME","ERROR","'?'","':'","','","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL",
  229. "'<'","'>'","LEQ","GEQ","LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'",
  230. "'~'","'#'","'('","')'","start","exp1","exp","@1","keywords",""
  231. };
  232. #endif
  233.  
  234. static const short yyr1[] = {     0,
  235.     34,    35,    35,    36,    36,    36,    36,    36,    37,    36,
  236.     36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
  237.     36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
  238.     36,    36,    36,    38,    38,    38
  239. };
  240.  
  241. static const short yyr2[] = {     0,
  242.      1,     1,     3,     2,     2,     2,     2,     2,     0,     6,
  243.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  244.      3,     3,     3,     3,     3,     3,     3,     3,     3,     5,
  245.      1,     1,     1,     0,     4,     2
  246. };
  247.  
  248. static const short yydefact[] = {     0,
  249.     31,    32,    33,     0,     0,     0,     0,     0,     0,     1,
  250.      2,     6,     4,     5,     7,     8,     0,     0,     0,     0,
  251.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  252.      0,     0,     0,     0,     0,     0,     0,     0,    11,     3,
  253.      0,    29,    28,    27,    26,    25,    19,    20,    23,    24,
  254.     21,    22,    17,    18,    15,    16,    12,    13,    14,    34,
  255.      0,    34,    34,     0,    30,    36,     0,    10,    34,    35,
  256.      0,     0,     0
  257. };
  258.  
  259. static const short yydefgoto[] = {    71,
  260.     10,    11,    38,    64
  261. };
  262.  
  263. static const short yypact[] = {    31,
  264. -32768,-32768,-32768,    31,    31,    31,    31,     4,    31,     3,
  265.     80,-32768,-32768,-32768,-32768,     6,    32,    31,    31,    31,
  266.     31,    31,    31,    31,    31,    31,    31,    31,    31,    31,
  267.     31,    31,    31,    31,    31,    31,    31,     7,-32768,    80,
  268.     59,    97,   113,   128,   142,   155,    25,    25,   162,   162,
  269.    162,   162,   167,   167,   -19,   -19,-32768,-32768,-32768,     5,
  270.     31,     5,     5,   -20,    80,-32768,    20,-32768,     5,-32768,
  271.     40,    56,-32768
  272. };
  273.  
  274. static const short yypgoto[] = {-32768,
  275.     49,    -4,-32768,   -58
  276. };
  277.  
  278.  
  279. #define    YYLAST        194
  280.  
  281.  
  282. static const short yytable[] = {    12,
  283.     13,    14,    15,    66,    67,    35,    36,    37,    16,    62,
  284.     70,    18,    68,    40,    41,    42,    43,    44,    45,    46,
  285.     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
  286.     57,    58,    59,     1,     2,     3,    63,    -9,    60,    72,
  287.     18,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  288.     36,    37,    69,     4,     5,    73,    65,    17,     0,     6,
  289.      7,     8,     9,     0,    39,    19,    61,     0,    20,    21,
  290.     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
  291.     32,    33,    34,    35,    36,    37,    19,     0,     0,    20,
  292.     21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
  293.     31,    32,    33,    34,    35,    36,    37,    21,    22,    23,
  294.     24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
  295.     34,    35,    36,    37,    22,    23,    24,    25,    26,    27,
  296.     28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
  297.     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
  298.     33,    34,    35,    36,    37,    24,    25,    26,    27,    28,
  299.     29,    30,    31,    32,    33,    34,    35,    36,    37,    25,
  300.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  301.     36,    37,    31,    32,    33,    34,    35,    36,    37,    33,
  302.     34,    35,    36,    37
  303. };
  304.  
  305. static const short yycheck[] = {     4,
  306.      5,     6,     7,    62,    63,    25,    26,    27,     5,     5,
  307.     69,     9,    33,    18,    19,    20,    21,    22,    23,    24,
  308.     25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
  309.     35,    36,    37,     3,     4,     5,    32,    32,    32,     0,
  310.      9,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  311.     26,    27,    33,    23,    24,     0,    61,     9,    -1,    29,
  312.     30,    31,    32,    -1,    33,     7,     8,    -1,    10,    11,
  313.     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
  314.     22,    23,    24,    25,    26,    27,     7,    -1,    -1,    10,
  315.     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
  316.     21,    22,    23,    24,    25,    26,    27,    11,    12,    13,
  317.     14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
  318.     24,    25,    26,    27,    12,    13,    14,    15,    16,    17,
  319.     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
  320.     13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
  321.     23,    24,    25,    26,    27,    14,    15,    16,    17,    18,
  322.     19,    20,    21,    22,    23,    24,    25,    26,    27,    15,
  323.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  324.     26,    27,    21,    22,    23,    24,    25,    26,    27,    23,
  325.     24,    25,    26,    27
  326. };
  327. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  328. #line 3 "/usr/local/lib/bison.simple"
  329.  
  330. /* Skeleton output parser for bison,
  331.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  332.  
  333.    This program is free software; you can redistribute it and/or modify
  334.    it under the terms of the GNU General Public License as published by
  335.    the Free Software Foundation; either version 1, or (at your option)
  336.    any later version.
  337.  
  338.    This program is distributed in the hope that it will be useful,
  339.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  340.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  341.    GNU General Public License for more details.
  342.  
  343.    You should have received a copy of the GNU General Public License
  344.    along with this program; if not, write to the Free Software
  345.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  346.  
  347.  
  348. #ifndef alloca
  349. #ifdef __GNUC__
  350. #define alloca __builtin_alloca
  351. #else /* not GNU C.  */
  352. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  353. #include <alloca.h>
  354. #else /* not sparc */
  355. #if defined (MSDOS) && !defined (__TURBOC__)
  356. #include <malloc.h>
  357. #else /* not MSDOS, or __TURBOC__ */
  358. #if defined(_AIX)
  359. #include <malloc.h>
  360.  #pragma alloca
  361. #else /* not MSDOS, __TURBOC__, or _AIX */
  362. #ifdef __hpux
  363. #ifdef __cplusplus
  364. extern "C" {
  365. void *alloca (unsigned int);
  366. };
  367. #else /* not __cplusplus */
  368. void *alloca ();
  369. #endif /* not __cplusplus */
  370. #endif /* __hpux */
  371. #endif /* not _AIX */
  372. #endif /* not MSDOS, or __TURBOC__ */
  373. #endif /* not sparc.  */
  374. #endif /* not GNU C.  */
  375. #endif /* alloca not defined.  */
  376.  
  377. /* This is the parser code that is written into each bison parser
  378.   when the %semantic_parser declaration is not specified in the grammar.
  379.   It was written by Richard Stallman by simplifying the hairy parser
  380.   used when %semantic_parser is specified.  */
  381.  
  382. /* Note: there must be only one dollar sign in this file.
  383.    It is replaced by the list of actions, each action
  384.    as one case of the switch.  */
  385.  
  386. #define yyerrok        (yyerrstatus = 0)
  387. #define yyclearin    (yychar = YYEMPTY)
  388. #define YYEMPTY        -2
  389. #define YYEOF        0
  390. #define YYACCEPT    return(0)
  391. #define YYABORT     return(1)
  392. #define YYERROR        goto yyerrlab1
  393. /* Like YYERROR except do call yyerror.
  394.    This remains here temporarily to ease the
  395.    transition to the new meaning of YYERROR, for GCC.
  396.    Once GCC version 2 has supplanted version 1, this can go.  */
  397. #define YYFAIL        goto yyerrlab
  398. #define YYRECOVERING()  (!!yyerrstatus)
  399. #define YYBACKUP(token, value) \
  400. do                                \
  401.   if (yychar == YYEMPTY && yylen == 1)                \
  402.     { yychar = (token), yylval = (value);            \
  403.       yychar1 = YYTRANSLATE (yychar);                \
  404.       YYPOPSTACK;                        \
  405.       goto yybackup;                        \
  406.     }                                \
  407.   else                                \
  408.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  409. while (0)
  410.  
  411. #define YYTERROR    1
  412. #define YYERRCODE    256
  413.  
  414. #ifndef YYPURE
  415. #define YYLEX        yylex()
  416. #endif
  417.  
  418. #ifdef YYPURE
  419. #ifdef YYLSP_NEEDED
  420. #define YYLEX        yylex(&yylval, &yylloc)
  421. #else
  422. #define YYLEX        yylex(&yylval)
  423. #endif
  424. #endif
  425.  
  426. /* If nonreentrant, generate the variables here */
  427.  
  428. #ifndef YYPURE
  429.  
  430. int    yychar;            /*  the lookahead symbol        */
  431. YYSTYPE    yylval;            /*  the semantic value of the        */
  432.                 /*  lookahead symbol            */
  433.  
  434. #ifdef YYLSP_NEEDED
  435. YYLTYPE yylloc;            /*  location data for the lookahead    */
  436.                 /*  symbol                */
  437. #endif
  438.  
  439. int yynerrs;            /*  number of parse errors so far       */
  440. #endif  /* not YYPURE */
  441.  
  442. #if YYDEBUG != 0
  443. int yydebug;            /*  nonzero means print parse trace    */
  444. /* Since this is uninitialized, it does not stop multiple parsers
  445.    from coexisting.  */
  446. #endif
  447.  
  448. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  449.  
  450. #ifndef    YYINITDEPTH
  451. #define YYINITDEPTH 200
  452. #endif
  453.  
  454. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  455.     (effective only if the built-in stack extension method is used).  */
  456.  
  457. #if YYMAXDEPTH == 0
  458. #undef YYMAXDEPTH
  459. #endif
  460.  
  461. #ifndef YYMAXDEPTH
  462. #define YYMAXDEPTH 10000
  463. #endif
  464.  
  465. /* Prevent warning if -Wstrict-prototypes.  */
  466. #ifdef __GNUC__
  467. int yyparse (void);
  468. #endif
  469.  
  470. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  471. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  472. #else                /* not GNU C or C++ */
  473. #ifndef __cplusplus
  474.  
  475. /* This is the most reliable way to avoid incompatibilities
  476.    in available built-in functions on various systems.  */
  477. static void
  478. __yy_bcopy (from, to, count)
  479.      char *from;
  480.      char *to;
  481.      int count;
  482. {
  483.   register char *f = from;
  484.   register char *t = to;
  485.   register int i = count;
  486.  
  487.   while (i-- > 0)
  488.     *t++ = *f++;
  489. }
  490.  
  491. #else /* __cplusplus */
  492.  
  493. /* This is the most reliable way to avoid incompatibilities
  494.    in available built-in functions on various systems.  */
  495. static void
  496. __yy_bcopy (char *from, char *to, int count)
  497. {
  498.   register char *f = from;
  499.   register char *t = to;
  500.   register int i = count;
  501.  
  502.   while (i-- > 0)
  503.     *t++ = *f++;
  504. }
  505.  
  506. #endif
  507. #endif
  508.  
  509. #line 184 "/usr/local/lib/bison.simple"
  510.  
  511. /* The user can define YYPARSE_PARAM as the name of an argument to be passed
  512.    into yyparse.  The argument should have type void *.
  513.    It should actually point to an object.
  514.    Grammar actions can access the variable by casting it
  515.    to the proper pointer type.  */
  516.  
  517. #ifdef YYPARSE_PARAM
  518. #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
  519. #else
  520. #define YYPARSE_PARAM
  521. #define YYPARSE_PARAM_DECL
  522. #endif
  523.  
  524. int
  525. yyparse(YYPARSE_PARAM)
  526.      YYPARSE_PARAM_DECL
  527. {
  528.   register int yystate;
  529.   register int yyn;
  530.   register short *yyssp;
  531.   register YYSTYPE *yyvsp;
  532.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  533.   int yychar1 = 0;        /*  lookahead token as an internal (translated) token number */
  534.  
  535.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  536.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  537.  
  538.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  539.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  540.  
  541. #ifdef YYLSP_NEEDED
  542.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  543.   YYLTYPE *yyls = yylsa;
  544.   YYLTYPE *yylsp;
  545.  
  546. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  547. #else
  548. #define YYPOPSTACK   (yyvsp--, yyssp--)
  549. #endif
  550.  
  551.   int yystacksize = YYINITDEPTH;
  552.  
  553. #ifdef YYPURE
  554.   int yychar;
  555.   YYSTYPE yylval;
  556.   int yynerrs;
  557. #ifdef YYLSP_NEEDED
  558.   YYLTYPE yylloc;
  559. #endif
  560. #endif
  561.  
  562.   YYSTYPE yyval;        /*  the variable used to return        */
  563.                 /*  semantic values from the action    */
  564.                 /*  routines                */
  565.  
  566.   int yylen;
  567.  
  568. #if YYDEBUG != 0
  569.   if (yydebug)
  570.     fprintf(stderr, "Starting parse\n");
  571. #endif
  572.  
  573.   yystate = 0;
  574.   yyerrstatus = 0;
  575.   yynerrs = 0;
  576.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  577.  
  578.   /* Initialize stack pointers.
  579.      Waste one element of value and location stack
  580.      so that they stay on the same level as the state stack.
  581.      The wasted elements are never initialized.  */
  582.  
  583.   yyssp = yyss - 1;
  584.   yyvsp = yyvs;
  585. #ifdef YYLSP_NEEDED
  586.   yylsp = yyls;
  587. #endif
  588.  
  589. /* Push a new state, which is found in  yystate  .  */
  590. /* In all cases, when you get here, the value and location stacks
  591.    have just been pushed. so pushing a state here evens the stacks.  */
  592. yynewstate:
  593.  
  594.   *++yyssp = yystate;
  595.  
  596.   if (yyssp >= yyss + yystacksize - 1)
  597.     {
  598.       /* Give user a chance to reallocate the stack */
  599.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  600.       YYSTYPE *yyvs1 = yyvs;
  601.       short *yyss1 = yyss;
  602. #ifdef YYLSP_NEEDED
  603.       YYLTYPE *yyls1 = yyls;
  604. #endif
  605.  
  606.       /* Get the current used size of the three stacks, in elements.  */
  607.       int size = yyssp - yyss + 1;
  608.  
  609. #ifdef yyoverflow
  610.       /* Each stack pointer address is followed by the size of
  611.      the data in use in that stack, in bytes.  */
  612. #ifdef YYLSP_NEEDED
  613.       /* This used to be a conditional around just the two extra args,
  614.      but that might be undefined if yyoverflow is a macro.  */
  615.       yyoverflow("parser stack overflow",
  616.          &yyss1, size * sizeof (*yyssp),
  617.          &yyvs1, size * sizeof (*yyvsp),
  618.          &yyls1, size * sizeof (*yylsp),
  619.          &yystacksize);
  620. #else
  621.       yyoverflow("parser stack overflow",
  622.          &yyss1, size * sizeof (*yyssp),
  623.          &yyvs1, size * sizeof (*yyvsp),
  624.          &yystacksize);
  625. #endif
  626.  
  627.       yyss = yyss1; yyvs = yyvs1;
  628. #ifdef YYLSP_NEEDED
  629.       yyls = yyls1;
  630. #endif
  631. #else /* no yyoverflow */
  632.       /* Extend the stack our own way.  */
  633.       if (yystacksize >= YYMAXDEPTH)
  634.     {
  635.       yyerror("parser stack overflow");
  636.       return 2;
  637.     }
  638.       yystacksize *= 2;
  639.       if (yystacksize > YYMAXDEPTH)
  640.     yystacksize = YYMAXDEPTH;
  641.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  642.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  643.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  644.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  645. #ifdef YYLSP_NEEDED
  646.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  647.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  648. #endif
  649. #endif /* no yyoverflow */
  650.  
  651.       yyssp = yyss + size - 1;
  652.       yyvsp = yyvs + size - 1;
  653. #ifdef YYLSP_NEEDED
  654.       yylsp = yyls + size - 1;
  655. #endif
  656.  
  657. #if YYDEBUG != 0
  658.       if (yydebug)
  659.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  660. #endif
  661.  
  662.       if (yyssp >= yyss + yystacksize - 1)
  663.     YYABORT;
  664.     }
  665.  
  666. #if YYDEBUG != 0
  667.   if (yydebug)
  668.     fprintf(stderr, "Entering state %d\n", yystate);
  669. #endif
  670.  
  671.   goto yybackup;
  672.  yybackup:
  673.  
  674. /* Do appropriate processing given the current state.  */
  675. /* Read a lookahead token if we need one and don't already have one.  */
  676. /* yyresume: */
  677.  
  678.   /* First try to decide what to do without reference to lookahead token.  */
  679.  
  680.   yyn = yypact[yystate];
  681.   if (yyn == YYFLAG)
  682.     goto yydefault;
  683.  
  684.   /* Not known => get a lookahead token if don't already have one.  */
  685.  
  686.   /* yychar is either YYEMPTY or YYEOF
  687.      or a valid token in external form.  */
  688.  
  689.   if (yychar == YYEMPTY)
  690.     {
  691. #if YYDEBUG != 0
  692.       if (yydebug)
  693.     fprintf(stderr, "Reading a token: ");
  694. #endif
  695.       yychar = YYLEX;
  696.     }
  697.  
  698.   /* Convert token to internal form (in yychar1) for indexing tables with */
  699.  
  700.   if (yychar <= 0)        /* This means end of input. */
  701.     {
  702.       yychar1 = 0;
  703.       yychar = YYEOF;        /* Don't call YYLEX any more */
  704.  
  705. #if YYDEBUG != 0
  706.       if (yydebug)
  707.     fprintf(stderr, "Now at end of input.\n");
  708. #endif
  709.     }
  710.   else
  711.     {
  712.       yychar1 = YYTRANSLATE(yychar);
  713.  
  714. #if YYDEBUG != 0
  715.       if (yydebug)
  716.     {
  717.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  718.       /* Give the individual parser a way to print the precise meaning
  719.          of a token, for further debugging info.  */
  720. #ifdef YYPRINT
  721.       YYPRINT (stderr, yychar, yylval);
  722. #endif
  723.       fprintf (stderr, ")\n");
  724.     }
  725. #endif
  726.     }
  727.  
  728.   yyn += yychar1;
  729.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  730.     goto yydefault;
  731.  
  732.   yyn = yytable[yyn];
  733.  
  734.   /* yyn is what to do for this token type in this state.
  735.      Negative => reduce, -yyn is rule number.
  736.      Positive => shift, yyn is new state.
  737.        New state is final state => don't bother to shift,
  738.        just return success.
  739.      0, or most negative number => error.  */
  740.  
  741.   if (yyn < 0)
  742.     {
  743.       if (yyn == YYFLAG)
  744.     goto yyerrlab;
  745.       yyn = -yyn;
  746.       goto yyreduce;
  747.     }
  748.   else if (yyn == 0)
  749.     goto yyerrlab;
  750.  
  751.   if (yyn == YYFINAL)
  752.     YYACCEPT;
  753.  
  754.   /* Shift the lookahead token.  */
  755.  
  756. #if YYDEBUG != 0
  757.   if (yydebug)
  758.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  759. #endif
  760.  
  761.   /* Discard the token being shifted unless it is eof.  */
  762.   if (yychar != YYEOF)
  763.     yychar = YYEMPTY;
  764.  
  765.   *++yyvsp = yylval;
  766. #ifdef YYLSP_NEEDED
  767.   *++yylsp = yylloc;
  768. #endif
  769.  
  770.   /* count tokens shifted since error; after three, turn off error status.  */
  771.   if (yyerrstatus) yyerrstatus--;
  772.  
  773.   yystate = yyn;
  774.   goto yynewstate;
  775.  
  776. /* Do the default action for the current state.  */
  777. yydefault:
  778.  
  779.   yyn = yydefact[yystate];
  780.   if (yyn == 0)
  781.     goto yyerrlab;
  782.  
  783. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  784. yyreduce:
  785.   yylen = yyr2[yyn];
  786.   if (yylen > 0)
  787.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  788.  
  789. #if YYDEBUG != 0
  790.   if (yydebug)
  791.     {
  792.       int i;
  793.  
  794.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  795.            yyn, yyrline[yyn]);
  796.  
  797.       /* Print the symbols being reduced, and their result.  */
  798.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  799.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  800.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  801.     }
  802. #endif
  803.  
  804.  
  805.   switch (yyn) {
  806.  
  807. case 1:
  808. #line 160 "cexp.y"
  809. { expression_value = yyvsp[0].integer.value; ;
  810.     break;}
  811. case 3:
  812. #line 166 "cexp.y"
  813. { if (pedantic)
  814.                 pedwarn ("comma operator in operand of `#if'");
  815.               yyval.integer = yyvsp[0].integer; ;
  816.     break;}
  817. case 4:
  818. #line 173 "cexp.y"
  819. { yyval.integer.value = - yyvsp[0].integer.value;
  820.               if ((yyval.integer.value & yyvsp[0].integer.value) < 0 && ! yyvsp[0].integer.unsignedp)
  821.                 integer_overflow ();
  822.               yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
  823.     break;}
  824. case 5:
  825. #line 178 "cexp.y"
  826. { yyval.integer.value = ! yyvsp[0].integer.value;
  827.               yyval.integer.unsignedp = 0; ;
  828.     break;}
  829. case 6:
  830. #line 181 "cexp.y"
  831. { yyval.integer = yyvsp[0].integer; ;
  832.     break;}
  833. case 7:
  834. #line 183 "cexp.y"
  835. { yyval.integer.value = ~ yyvsp[0].integer.value;
  836.               yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
  837.     break;}
  838. case 8:
  839. #line 186 "cexp.y"
  840. { yyval.integer.value = check_assertion (yyvsp[0].name.address, yyvsp[0].name.length,
  841.                               0, NULL_PTR);
  842.               yyval.integer.unsignedp = 0; ;
  843.     break;}
  844. case 9:
  845. #line 190 "cexp.y"
  846. { keyword_parsing = 1; ;
  847.     break;}
  848. case 10:
  849. #line 192 "cexp.y"
  850. { yyval.integer.value = check_assertion (yyvsp[-4].name.address, yyvsp[-4].name.length,
  851.                               1, yyvsp[-1].keywords);
  852.               keyword_parsing = 0;
  853.               yyval.integer.unsignedp = 0; ;
  854.     break;}
  855. case 11:
  856. #line 197 "cexp.y"
  857. { yyval.integer = yyvsp[-1].integer; ;
  858.     break;}
  859. case 12:
  860. #line 202 "cexp.y"
  861. { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  862.               if (yyval.integer.unsignedp)
  863.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value * yyvsp[0].integer.value;
  864.               else
  865.                 {
  866.                   yyval.integer.value = yyvsp[-2].integer.value * yyvsp[0].integer.value;
  867.                   if (yyvsp[-2].integer.value
  868.                   && (yyval.integer.value / yyvsp[-2].integer.value != yyvsp[0].integer.value
  869.                       || (yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0))
  870.                 integer_overflow ();
  871.                 } ;
  872.     break;}
  873. case 13:
  874. #line 214 "cexp.y"
  875. { if (yyvsp[0].integer.value == 0)
  876.                 {
  877.                   error ("division by zero in #if");
  878.                   yyvsp[0].integer.value = 1;
  879.                 }
  880.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  881.               if (yyval.integer.unsignedp)
  882.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value / yyvsp[0].integer.value;
  883.               else
  884.                 {
  885.                   yyval.integer.value = yyvsp[-2].integer.value / yyvsp[0].integer.value;
  886.                   if ((yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0)
  887.                 integer_overflow ();
  888.                 } ;
  889.     break;}
  890. case 14:
  891. #line 229 "cexp.y"
  892. { if (yyvsp[0].integer.value == 0)
  893.                 {
  894.                   error ("division by zero in #if");
  895.                   yyvsp[0].integer.value = 1;
  896.                 }
  897.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  898.               if (yyval.integer.unsignedp)
  899.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value % yyvsp[0].integer.value;
  900.               else
  901.                 yyval.integer.value = yyvsp[-2].integer.value % yyvsp[0].integer.value; ;
  902.     break;}
  903. case 15:
  904. #line 240 "cexp.y"
  905. { yyval.integer.value = yyvsp[-2].integer.value + yyvsp[0].integer.value;
  906.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  907.               if (! yyval.integer.unsignedp
  908.                   && ! possible_sum_sign (yyvsp[-2].integer.value, yyvsp[0].integer.value,
  909.                               yyval.integer.value))
  910.                 integer_overflow (); ;
  911.     break;}
  912. case 16:
  913. #line 247 "cexp.y"
  914. { yyval.integer.value = yyvsp[-2].integer.value - yyvsp[0].integer.value;
  915.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  916.               if (! yyval.integer.unsignedp
  917.                   && ! possible_sum_sign (yyval.integer.value, yyvsp[0].integer.value,
  918.                               yyvsp[-2].integer.value))
  919.                 integer_overflow (); ;
  920.     break;}
  921. case 17:
  922. #line 254 "cexp.y"
  923. { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
  924.               if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp)
  925.                 yyval.integer.value = right_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
  926.               else
  927.                 yyval.integer.value = left_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
  928.     break;}
  929. case 18:
  930. #line 260 "cexp.y"
  931. { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
  932.               if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp)
  933.                 yyval.integer.value = left_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
  934.               else
  935.                 yyval.integer.value = right_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
  936.     break;}
  937. case 19:
  938. #line 266 "cexp.y"
  939. { yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value);
  940.               yyval.integer.unsignedp = 0; ;
  941.     break;}
  942. case 20:
  943. #line 269 "cexp.y"
  944. { yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value);
  945.               yyval.integer.unsignedp = 0; ;
  946.     break;}
  947. case 21:
  948. #line 272 "cexp.y"
  949. { yyval.integer.unsignedp = 0;
  950.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  951.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value <= yyvsp[0].integer.value;
  952.               else
  953.                 yyval.integer.value = yyvsp[-2].integer.value <= yyvsp[0].integer.value; ;
  954.     break;}
  955. case 22:
  956. #line 278 "cexp.y"
  957. { yyval.integer.unsignedp = 0;
  958.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  959.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value >= yyvsp[0].integer.value;
  960.               else
  961.                 yyval.integer.value = yyvsp[-2].integer.value >= yyvsp[0].integer.value; ;
  962.     break;}
  963. case 23:
  964. #line 284 "cexp.y"
  965. { yyval.integer.unsignedp = 0;
  966.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  967.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value < yyvsp[0].integer.value;
  968.               else
  969.                 yyval.integer.value = yyvsp[-2].integer.value < yyvsp[0].integer.value; ;
  970.     break;}
  971. case 24:
  972. #line 290 "cexp.y"
  973. { yyval.integer.unsignedp = 0;
  974.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  975.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value > yyvsp[0].integer.value;
  976.               else
  977.                 yyval.integer.value = yyvsp[-2].integer.value > yyvsp[0].integer.value; ;
  978.     break;}
  979. case 25:
  980. #line 296 "cexp.y"
  981. { yyval.integer.value = yyvsp[-2].integer.value & yyvsp[0].integer.value;
  982.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  983.     break;}
  984. case 26:
  985. #line 299 "cexp.y"
  986. { yyval.integer.value = yyvsp[-2].integer.value ^ yyvsp[0].integer.value;
  987.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  988.     break;}
  989. case 27:
  990. #line 302 "cexp.y"
  991. { yyval.integer.value = yyvsp[-2].integer.value | yyvsp[0].integer.value;
  992.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  993.     break;}
  994. case 28:
  995. #line 305 "cexp.y"
  996. { yyval.integer.value = (yyvsp[-2].integer.value && yyvsp[0].integer.value);
  997.               yyval.integer.unsignedp = 0; ;
  998.     break;}
  999. case 29:
  1000. #line 308 "cexp.y"
  1001. { yyval.integer.value = (yyvsp[-2].integer.value || yyvsp[0].integer.value);
  1002.               yyval.integer.unsignedp = 0; ;
  1003.     break;}
  1004. case 30:
  1005. #line 311 "cexp.y"
  1006. { yyval.integer.value = yyvsp[-4].integer.value ? yyvsp[-2].integer.value : yyvsp[0].integer.value;
  1007.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  1008.     break;}
  1009. case 31:
  1010. #line 314 "cexp.y"
  1011. { yyval.integer = yylval.integer; ;
  1012.     break;}
  1013. case 32:
  1014. #line 316 "cexp.y"
  1015. { yyval.integer = yylval.integer; ;
  1016.     break;}
  1017. case 33:
  1018. #line 318 "cexp.y"
  1019. { yyval.integer.value = 0;
  1020.               yyval.integer.unsignedp = 0; ;
  1021.     break;}
  1022. case 34:
  1023. #line 323 "cexp.y"
  1024. { yyval.keywords = 0; ;
  1025.     break;}
  1026. case 35:
  1027. #line 325 "cexp.y"
  1028. { struct arglist *temp;
  1029.               yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
  1030.               yyval.keywords->next = yyvsp[-2].keywords;
  1031.               yyval.keywords->name = (U_CHAR *) "(";
  1032.               yyval.keywords->length = 1;
  1033.               temp = yyval.keywords;
  1034.               while (temp != 0 && temp->next != 0)
  1035.                 temp = temp->next;
  1036.               temp->next = (struct arglist *) xmalloc (sizeof (struct arglist));
  1037.               temp->next->next = yyvsp[0].keywords;
  1038.               temp->next->name = (U_CHAR *) ")";
  1039.               temp->next->length = 1; ;
  1040.     break;}
  1041. case 36:
  1042. #line 338 "cexp.y"
  1043. { yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
  1044.               yyval.keywords->name = yyvsp[-1].name.address;
  1045.               yyval.keywords->length = yyvsp[-1].name.length;
  1046.               yyval.keywords->next = yyvsp[0].keywords; ;
  1047.     break;}
  1048. }
  1049.    /* the action file gets copied in in place of this dollarsign */
  1050. #line 480 "/usr/local/lib/bison.simple"
  1051.  
  1052.   yyvsp -= yylen;
  1053.   yyssp -= yylen;
  1054. #ifdef YYLSP_NEEDED
  1055.   yylsp -= yylen;
  1056. #endif
  1057.  
  1058. #if YYDEBUG != 0
  1059.   if (yydebug)
  1060.     {
  1061.       short *ssp1 = yyss - 1;
  1062.       fprintf (stderr, "state stack now");
  1063.       while (ssp1 != yyssp)
  1064.     fprintf (stderr, " %d", *++ssp1);
  1065.       fprintf (stderr, "\n");
  1066.     }
  1067. #endif
  1068.  
  1069.   *++yyvsp = yyval;
  1070.  
  1071. #ifdef YYLSP_NEEDED
  1072.   yylsp++;
  1073.   if (yylen == 0)
  1074.     {
  1075.       yylsp->first_line = yylloc.first_line;
  1076.       yylsp->first_column = yylloc.first_column;
  1077.       yylsp->last_line = (yylsp-1)->last_line;
  1078.       yylsp->last_column = (yylsp-1)->last_column;
  1079.       yylsp->text = 0;
  1080.     }
  1081.   else
  1082.     {
  1083.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1084.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1085.     }
  1086. #endif
  1087.  
  1088.   /* Now "shift" the result of the reduction.
  1089.      Determine what state that goes to,
  1090.      based on the state we popped back to
  1091.      and the rule number reduced by.  */
  1092.  
  1093.   yyn = yyr1[yyn];
  1094.  
  1095.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1096.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1097.     yystate = yytable[yystate];
  1098.   else
  1099.     yystate = yydefgoto[yyn - YYNTBASE];
  1100.  
  1101.   goto yynewstate;
  1102.  
  1103. yyerrlab:   /* here on detecting error */
  1104.  
  1105.   if (! yyerrstatus)
  1106.     /* If not already recovering from an error, report this error.  */
  1107.     {
  1108.       ++yynerrs;
  1109.  
  1110. #ifdef YYERROR_VERBOSE
  1111.       yyn = yypact[yystate];
  1112.  
  1113.       if (yyn > YYFLAG && yyn < YYLAST)
  1114.     {
  1115.       int size = 0;
  1116.       char *msg;
  1117.       int x, count;
  1118.  
  1119.       count = 0;
  1120.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  1121.       for (x = (yyn < 0 ? -yyn : 0);
  1122.            x < (sizeof(yytname) / sizeof(char *)); x++)
  1123.         if (yycheck[x + yyn] == x)
  1124.           size += strlen(yytname[x]) + 15, count++;
  1125.       msg = (char *) malloc(size + 15);
  1126.       if (msg != 0)
  1127.         {
  1128.           strcpy(msg, "parse error");
  1129.  
  1130.           if (count < 5)
  1131.         {
  1132.           count = 0;
  1133.           for (x = (yyn < 0 ? -yyn : 0);
  1134.                x < (sizeof(yytname) / sizeof(char *)); x++)
  1135.             if (yycheck[x + yyn] == x)
  1136.               {
  1137.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1138.             strcat(msg, yytname[x]);
  1139.             strcat(msg, "'");
  1140.             count++;
  1141.               }
  1142.         }
  1143.           yyerror(msg);
  1144.           free(msg);
  1145.         }
  1146.       else
  1147.         yyerror ("parse error; also virtual memory exceeded");
  1148.     }
  1149.       else
  1150. #endif /* YYERROR_VERBOSE */
  1151.     yyerror("parse error");
  1152.     }
  1153.  
  1154.   goto yyerrlab1;
  1155. yyerrlab1:   /* here on error raised explicitly by an action */
  1156.  
  1157.   if (yyerrstatus == 3)
  1158.     {
  1159.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1160.  
  1161.       /* return failure if at end of input */
  1162.       if (yychar == YYEOF)
  1163.     YYABORT;
  1164.  
  1165. #if YYDEBUG != 0
  1166.       if (yydebug)
  1167.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1168. #endif
  1169.  
  1170.       yychar = YYEMPTY;
  1171.     }
  1172.  
  1173.   /* Else will try to reuse lookahead token
  1174.      after shifting the error token.  */
  1175.  
  1176.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1177.  
  1178.   goto yyerrhandle;
  1179.  
  1180. yyerrdefault:  /* current state does not do anything special for the error token. */
  1181.  
  1182. #if 0
  1183.   /* This is wrong; only states that explicitly want error tokens
  1184.      should shift them.  */
  1185.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1186.   if (yyn) goto yydefault;
  1187. #endif
  1188.  
  1189. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1190.  
  1191.   if (yyssp == yyss) YYABORT;
  1192.   yyvsp--;
  1193.   yystate = *--yyssp;
  1194. #ifdef YYLSP_NEEDED
  1195.   yylsp--;
  1196. #endif
  1197.  
  1198. #if YYDEBUG != 0
  1199.   if (yydebug)
  1200.     {
  1201.       short *ssp1 = yyss - 1;
  1202.       fprintf (stderr, "Error: state stack now");
  1203.       while (ssp1 != yyssp)
  1204.     fprintf (stderr, " %d", *++ssp1);
  1205.       fprintf (stderr, "\n");
  1206.     }
  1207. #endif
  1208.  
  1209. yyerrhandle:
  1210.  
  1211.   yyn = yypact[yystate];
  1212.   if (yyn == YYFLAG)
  1213.     goto yyerrdefault;
  1214.  
  1215.   yyn += YYTERROR;
  1216.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1217.     goto yyerrdefault;
  1218.  
  1219.   yyn = yytable[yyn];
  1220.   if (yyn < 0)
  1221.     {
  1222.       if (yyn == YYFLAG)
  1223.     goto yyerrpop;
  1224.       yyn = -yyn;
  1225.       goto yyreduce;
  1226.     }
  1227.   else if (yyn == 0)
  1228.     goto yyerrpop;
  1229.  
  1230.   if (yyn == YYFINAL)
  1231.     YYACCEPT;
  1232.  
  1233. #if YYDEBUG != 0
  1234.   if (yydebug)
  1235.     fprintf(stderr, "Shifting error token, ");
  1236. #endif
  1237.  
  1238.   *++yyvsp = yylval;
  1239. #ifdef YYLSP_NEEDED
  1240.   *++yylsp = yylloc;
  1241. #endif
  1242.  
  1243.   yystate = yyn;
  1244.   goto yynewstate;
  1245. }
  1246. #line 343 "cexp.y"
  1247.  
  1248.  
  1249. /* During parsing of a C expression, the pointer to the next character
  1250.    is in this variable.  */
  1251.  
  1252. static char *lexptr;
  1253.  
  1254. /* Take care of parsing a number (anything that starts with a digit).
  1255.    Set yylval and return the token type; update lexptr.
  1256.    LEN is the number of characters in it.  */
  1257.  
  1258. /* maybe needs to actually deal with floating point numbers */
  1259.  
  1260. int
  1261. parse_number (olen)
  1262.      int olen;
  1263. {
  1264.   register char *p = lexptr;
  1265.   register int c;
  1266.   register unsigned long n = 0, nd, ULONG_MAX_over_base;
  1267.   register int base = 10;
  1268.   register int len = olen;
  1269.   register int overflow = 0;
  1270.   register int digit, largest_digit = 0;
  1271.   int spec_long = 0;
  1272.  
  1273.   for (c = 0; c < len; c++)
  1274.     if (p[c] == '.') {
  1275.       /* It's a float since it contains a point.  */
  1276.       yyerror ("floating point numbers not allowed in #if expressions");
  1277.       return ERROR;
  1278.     }
  1279.  
  1280.   yylval.integer.unsignedp = 0;
  1281.  
  1282.   if (len >= 3 && (!strncmp (p, "0x", 2) || !strncmp (p, "0X", 2))) {
  1283.     p += 2;
  1284.     base = 16;
  1285.     len -= 2;
  1286.   }
  1287.   else if (*p == '0')
  1288.     base = 8;
  1289.  
  1290.   ULONG_MAX_over_base = (unsigned long) -1 / base;
  1291.  
  1292.   for (; len > 0; len--) {
  1293.     c = *p++;
  1294.  
  1295.     if (c >= '0' && c <= '9')
  1296.       digit = c - '0';
  1297.     else if (base == 16 && c >= 'a' && c <= 'f')
  1298.       digit = c - 'a' + 10;
  1299.     else if (base == 16 && c >= 'A' && c <= 'F')
  1300.       digit = c - 'A' + 10;
  1301.     else {
  1302.       /* `l' means long, and `u' means unsigned.  */
  1303.       while (1) {
  1304.     if (c == 'l' || c == 'L')
  1305.       {
  1306.         if (spec_long)
  1307.           yyerror ("two `l's in integer constant");
  1308.         spec_long = 1;
  1309.       }
  1310.     else if (c == 'u' || c == 'U')
  1311.       {
  1312.         if (yylval.integer.unsignedp)
  1313.           yyerror ("two `u's in integer constant");
  1314.         yylval.integer.unsignedp = 1;
  1315.       }
  1316.     else
  1317.       break;
  1318.  
  1319.     if (--len == 0)
  1320.       break;
  1321.     c = *p++;
  1322.       }
  1323.       /* Don't look for any more digits after the suffixes.  */
  1324.       break;
  1325.     }
  1326.     if (largest_digit < digit)
  1327.       largest_digit = digit;
  1328.     nd = n * base + digit;
  1329.     overflow |= ULONG_MAX_over_base < n | nd < n;
  1330.     n = nd;
  1331.   }
  1332.  
  1333.   if (len != 0) {
  1334.     yyerror ("Invalid number in #if expression");
  1335.     return ERROR;
  1336.   }
  1337.  
  1338.   if (base <= largest_digit)
  1339.     warning ("integer constant contains digits beyond the radix");
  1340.  
  1341.   if (overflow)
  1342.     warning ("integer constant out of range");
  1343.  
  1344.   /* If too big to be signed, consider it unsigned.  */
  1345.   if ((long) n < 0 && ! yylval.integer.unsignedp)
  1346.     {
  1347.       if (base == 10)
  1348.     warning ("integer constant is so large that it is unsigned");
  1349.       yylval.integer.unsignedp = 1;
  1350.     }
  1351.  
  1352.   lexptr = p;
  1353.   yylval.integer.value = n;
  1354.   return INT;
  1355. }
  1356.  
  1357. struct token {
  1358.   char *operator;
  1359.   int token;
  1360. };
  1361.  
  1362. static struct token tokentab2[] = {
  1363.   {"&&", AND},
  1364.   {"||", OR},
  1365.   {"<<", LSH},
  1366.   {">>", RSH},
  1367.   {"==", EQUAL},
  1368.   {"!=", NOTEQUAL},
  1369.   {"<=", LEQ},
  1370.   {">=", GEQ},
  1371.   {"++", ERROR},
  1372.   {"--", ERROR},
  1373.   {NULL, ERROR}
  1374. };
  1375.  
  1376. /* Read one token, getting characters through lexptr.  */
  1377.  
  1378. int
  1379. yylex ()
  1380. {
  1381.   register int c;
  1382.   register int namelen;
  1383.   register unsigned char *tokstart;
  1384.   register struct token *toktab;
  1385.   int wide_flag;
  1386.  
  1387.  retry:
  1388.  
  1389.   tokstart = (unsigned char *) lexptr;
  1390.   c = *tokstart;
  1391.   /* See if it is a special token of length 2.  */
  1392.   if (! keyword_parsing)
  1393.     for (toktab = tokentab2; toktab->operator != NULL; toktab++)
  1394.       if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) {
  1395.     lexptr += 2;
  1396.     if (toktab->token == ERROR)
  1397.       {
  1398.         char *buf = (char *) alloca (40);
  1399.         sprintf (buf, "`%s' not allowed in operand of `#if'", toktab->operator);
  1400.         yyerror (buf);
  1401.       }
  1402.     return toktab->token;
  1403.       }
  1404.  
  1405.   switch (c) {
  1406.   case 0:
  1407.     return 0;
  1408.     
  1409.   case ' ':
  1410.   case '\t':
  1411.   case '\r':
  1412.   case '\n':
  1413.     lexptr++;
  1414.     goto retry;
  1415.     
  1416.   case 'L':
  1417.     /* Capital L may start a wide-string or wide-character constant.  */
  1418.     if (lexptr[1] == '\'')
  1419.       {
  1420.     lexptr++;
  1421.     wide_flag = 1;
  1422.     goto char_constant;
  1423.       }
  1424.     if (lexptr[1] == '"')
  1425.       {
  1426.     lexptr++;
  1427.     wide_flag = 1;
  1428.     goto string_constant;
  1429.       }
  1430.     break;
  1431.  
  1432.   case '\'':
  1433.     wide_flag = 0;
  1434.   char_constant:
  1435.     lexptr++;
  1436.     if (keyword_parsing) {
  1437.       char *start_ptr = lexptr - 1;
  1438.       while (1) {
  1439.     c = *lexptr++;
  1440.     if (c == '\\')
  1441.       c = parse_escape (&lexptr);
  1442.     else if (c == '\'')
  1443.       break;
  1444.       }
  1445.       yylval.name.address = tokstart;
  1446.       yylval.name.length = lexptr - start_ptr;
  1447.       return NAME;
  1448.     }
  1449.  
  1450.     /* This code for reading a character constant
  1451.        handles multicharacter constants and wide characters.
  1452.        It is mostly copied from c-lex.c.  */
  1453.     {
  1454.       register int result = 0;
  1455.       register num_chars = 0;
  1456.       unsigned width = MAX_CHAR_TYPE_SIZE;
  1457.       int max_chars;
  1458.       char *token_buffer;
  1459.  
  1460.       if (wide_flag)
  1461.     {
  1462.       width = MAX_WCHAR_TYPE_SIZE;
  1463. #ifdef MULTIBYTE_CHARS
  1464.       max_chars = MB_CUR_MAX;
  1465. #else
  1466.       max_chars = 1;
  1467. #endif
  1468.     }
  1469.       else
  1470.     max_chars = MAX_LONG_TYPE_SIZE / width;
  1471.  
  1472.       token_buffer = (char *) alloca (max_chars + 1);
  1473.  
  1474.       while (1)
  1475.     {
  1476.       c = *lexptr++;
  1477.  
  1478.       if (c == '\'' || c == EOF)
  1479.         break;
  1480.  
  1481.       if (c == '\\')
  1482.         {
  1483.           c = parse_escape (&lexptr);
  1484.           if (width < HOST_BITS_PER_INT
  1485.           && (unsigned) c >= (1 << width))
  1486.         pedwarn ("escape sequence out of range for character");
  1487.         }
  1488.  
  1489.       num_chars++;
  1490.  
  1491.       /* Merge character into result; ignore excess chars.  */
  1492.       if (num_chars < max_chars + 1)
  1493.         {
  1494.           if (width < HOST_BITS_PER_INT)
  1495.         result = (result << width) | (c & ((1 << width) - 1));
  1496.           else
  1497.         result = c;
  1498.           token_buffer[num_chars - 1] = c;
  1499.         }
  1500.     }
  1501.  
  1502.       token_buffer[num_chars] = 0;
  1503.  
  1504.       if (c != '\'')
  1505.     error ("malformatted character constant");
  1506.       else if (num_chars == 0)
  1507.     error ("empty character constant");
  1508.       else if (num_chars > max_chars)
  1509.     {
  1510.       num_chars = max_chars;
  1511.       error ("character constant too long");
  1512.     }
  1513.       else if (num_chars != 1 && ! traditional)
  1514.     warning ("multi-character character constant");
  1515.  
  1516.       /* If char type is signed, sign-extend the constant.  */
  1517.       if (! wide_flag)
  1518.     {
  1519.       int num_bits = num_chars * width;
  1520.  
  1521.       if (lookup ("__CHAR_UNSIGNED__", sizeof ("__CHAR_UNSIGNED__")-1, -1)
  1522.           || ((result >> (num_bits - 1)) & 1) == 0)
  1523.         yylval.integer.value
  1524.           = result & ((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
  1525.       else
  1526.         yylval.integer.value
  1527.           = result | ~((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
  1528.     }
  1529.       else
  1530.     {
  1531. #ifdef MULTIBYTE_CHARS
  1532.       /* Set the initial shift state and convert the next sequence.  */
  1533.       result = 0;
  1534.       /* In all locales L'\0' is zero and mbtowc will return zero,
  1535.          so don't use it.  */
  1536.       if (num_chars > 1
  1537.           || (num_chars == 1 && token_buffer[0] != '\0'))
  1538.         {
  1539.           wchar_t wc;
  1540.           (void) mbtowc (NULL_PTR, NULL_PTR, 0);
  1541.           if (mbtowc (& wc, token_buffer, num_chars) == num_chars)
  1542.         result = wc;
  1543.           else
  1544.         warning ("Ignoring invalid multibyte character");
  1545.         }
  1546. #endif
  1547.       yylval.integer.value = result;
  1548.     }
  1549.     }
  1550.  
  1551.     /* This is always a signed type.  */
  1552.     yylval.integer.unsignedp = 0;
  1553.     
  1554.     return CHAR;
  1555.  
  1556.     /* some of these chars are invalid in constant expressions;
  1557.        maybe do something about them later */
  1558.   case '/':
  1559.   case '+':
  1560.   case '-':
  1561.   case '*':
  1562.   case '%':
  1563.   case '|':
  1564.   case '&':
  1565.   case '^':
  1566.   case '~':
  1567.   case '!':
  1568.   case '@':
  1569.   case '<':
  1570.   case '>':
  1571.   case '[':
  1572.   case ']':
  1573.   case '.':
  1574.   case '?':
  1575.   case ':':
  1576.   case '=':
  1577.   case '{':
  1578.   case '}':
  1579.   case ',':
  1580.   case '#':
  1581.     if (keyword_parsing)
  1582.       break;
  1583.   case '(':
  1584.   case ')':
  1585.     lexptr++;
  1586.     return c;
  1587.  
  1588.   case '"':
  1589.   string_constant:
  1590.     if (keyword_parsing) {
  1591.       char *start_ptr = lexptr;
  1592.       lexptr++;
  1593.       while (1) {
  1594.     c = *lexptr++;
  1595.     if (c == '\\')
  1596.       c = parse_escape (&lexptr);
  1597.     else if (c == '"')
  1598.       break;
  1599.       }
  1600.       yylval.name.address = tokstart;
  1601.       yylval.name.length = lexptr - start_ptr;
  1602.       return NAME;
  1603.     }
  1604.     yyerror ("string constants not allowed in #if expressions");
  1605.     return ERROR;
  1606.   }
  1607.  
  1608.   if (c >= '0' && c <= '9' && !keyword_parsing) {
  1609.     /* It's a number */
  1610.     for (namelen = 0;
  1611.      c = tokstart[namelen], is_idchar[c] || c == '.'; 
  1612.      namelen++)
  1613.       ;
  1614.     return parse_number (namelen);
  1615.   }
  1616.  
  1617.   /* It is a name.  See how long it is.  */
  1618.  
  1619.   if (keyword_parsing) {
  1620.     for (namelen = 0;; namelen++) {
  1621.       if (is_hor_space[tokstart[namelen]])
  1622.     break;
  1623.       if (tokstart[namelen] == '(' || tokstart[namelen] == ')')
  1624.     break;
  1625.       if (tokstart[namelen] == '"' || tokstart[namelen] == '\'')
  1626.     break;
  1627.     }
  1628.   } else {
  1629.     if (!is_idstart[c]) {
  1630.       yyerror ("Invalid token in expression");
  1631.       return ERROR;
  1632.     }
  1633.  
  1634.     for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++)
  1635.       ;
  1636.   }
  1637.   
  1638.   lexptr += namelen;
  1639.   yylval.name.address = tokstart;
  1640.   yylval.name.length = namelen;
  1641.   return NAME;
  1642. }
  1643.  
  1644.  
  1645. /* Parse a C escape sequence.  STRING_PTR points to a variable
  1646.    containing a pointer to the string to parse.  That pointer
  1647.    is updated past the characters we use.  The value of the
  1648.    escape sequence is returned.
  1649.  
  1650.    A negative value means the sequence \ newline was seen,
  1651.    which is supposed to be equivalent to nothing at all.
  1652.  
  1653.    If \ is followed by a null character, we return a negative
  1654.    value and leave the string pointer pointing at the null character.
  1655.  
  1656.    If \ is followed by 000, we return 0 and leave the string pointer
  1657.    after the zeros.  A value of 0 does not mean end of string.  */
  1658.  
  1659. int
  1660. parse_escape (string_ptr)
  1661.      char **string_ptr;
  1662. {
  1663.   register int c = *(*string_ptr)++;
  1664.   switch (c)
  1665.     {
  1666.     case 'a':
  1667.       return TARGET_BELL;
  1668.     case 'b':
  1669.       return TARGET_BS;
  1670.     case 'e':
  1671.     case 'E':
  1672.       if (pedantic)
  1673.     pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
  1674.       return 033;
  1675.     case 'f':
  1676.       return TARGET_FF;
  1677.     case 'n':
  1678.       return TARGET_NEWLINE;
  1679.     case 'r':
  1680.       return TARGET_CR;
  1681.     case 't':
  1682.       return TARGET_TAB;
  1683.     case 'v':
  1684.       return TARGET_VT;
  1685.     case '\n':
  1686.       return -2;
  1687.     case 0:
  1688.       (*string_ptr)--;
  1689.       return 0;
  1690.       
  1691.     case '0':
  1692.     case '1':
  1693.     case '2':
  1694.     case '3':
  1695.     case '4':
  1696.     case '5':
  1697.     case '6':
  1698.     case '7':
  1699.       {
  1700.     register int i = c - '0';
  1701.     register int count = 0;
  1702.     while (++count < 3)
  1703.       {
  1704.         c = *(*string_ptr)++;
  1705.         if (c >= '0' && c <= '7')
  1706.           i = (i << 3) + c - '0';
  1707.         else
  1708.           {
  1709.         (*string_ptr)--;
  1710.         break;
  1711.           }
  1712.       }
  1713.     if ((i & ~((1 << MAX_CHAR_TYPE_SIZE) - 1)) != 0)
  1714.       {
  1715.         i &= (1 << MAX_CHAR_TYPE_SIZE) - 1;
  1716.         warning ("octal character constant does not fit in a byte");
  1717.       }
  1718.     return i;
  1719.       }
  1720.     case 'x':
  1721.       {
  1722.     register unsigned i = 0, overflow = 0, digits_found = 0, digit;
  1723.     for (;;)
  1724.       {
  1725.         c = *(*string_ptr)++;
  1726.         if (c >= '0' && c <= '9')
  1727.           digit = c - '0';
  1728.         else if (c >= 'a' && c <= 'f')
  1729.           digit = c - 'a' + 10;
  1730.         else if (c >= 'A' && c <= 'F')
  1731.           digit = c - 'A' + 10;
  1732.         else
  1733.           {
  1734.         (*string_ptr)--;
  1735.         break;
  1736.           }
  1737.         overflow |= i ^ (i << 4 >> 4);
  1738.         i = (i << 4) + digit;
  1739.         digits_found = 1;
  1740.       }
  1741.     if (!digits_found)
  1742.       yyerror ("\\x used with no following hex digits");
  1743.     if (overflow | (i & ~((1 << BITS_PER_UNIT) - 1)))
  1744.       {
  1745.         i &= (1 << BITS_PER_UNIT) - 1;
  1746.         warning ("hex character constant does not fit in a byte");
  1747.       }
  1748.     return i;
  1749.       }
  1750.     default:
  1751.       return c;
  1752.     }
  1753. }
  1754.  
  1755. void
  1756. yyerror (s)
  1757.      char *s;
  1758. {
  1759.   error (s);
  1760.   longjmp (parse_return_error, 1);
  1761. }
  1762.  
  1763. static void
  1764. integer_overflow ()
  1765. {
  1766.   if (pedantic)
  1767.     pedwarn ("integer overflow in preprocessor expression");
  1768. }
  1769.  
  1770. static long
  1771. left_shift (a, b)
  1772.      struct constant *a;
  1773.      unsigned long b;
  1774. {
  1775.   if (b >= HOST_BITS_PER_LONG)
  1776.     {
  1777.       if (! a->unsignedp && a->value != 0)
  1778.     integer_overflow ();
  1779.       return 0;
  1780.     }
  1781.   else if (a->unsignedp)
  1782.     return (unsigned long) a->value << b;
  1783.   else
  1784.     {
  1785.       long l = a->value << b;
  1786.       if (l >> b != a->value)
  1787.     integer_overflow ();
  1788.       return l;
  1789.     }
  1790. }
  1791.  
  1792. static long
  1793. right_shift (a, b)
  1794.      struct constant *a;
  1795.      unsigned long b;
  1796. {
  1797.   if (b >= HOST_BITS_PER_LONG)
  1798.     return a->unsignedp ? 0 : a->value >> (HOST_BITS_PER_LONG - 1);
  1799.   else if (a->unsignedp)
  1800.     return (unsigned long) a->value >> b;
  1801.   else
  1802.     return a->value >> b;
  1803. }
  1804.  
  1805. /* This page contains the entry point to this file.  */
  1806.  
  1807. /* Parse STRING as an expression, and complain if this fails
  1808.    to use up all of the contents of STRING.  */
  1809. /* We do not support C comments.  They should be removed before
  1810.    this function is called.  */
  1811.  
  1812. int
  1813. parse_c_expression (string)
  1814.      char *string;
  1815. {
  1816.   lexptr = string;
  1817.   
  1818.   if (lexptr == 0 || *lexptr == 0) {
  1819.     error ("empty #if expression");
  1820.     return 0;            /* don't include the #if group */
  1821.   }
  1822.  
  1823.   /* if there is some sort of scanning error, just return 0 and assume
  1824.      the parsing routine has printed an error message somewhere.
  1825.      there is surely a better thing to do than this.     */
  1826.   if (setjmp (parse_return_error))
  1827.     return 0;
  1828.  
  1829.   if (yyparse ())
  1830.     return 0;            /* actually this is never reached
  1831.                    the way things stand. */
  1832.   if (*lexptr)
  1833.     error ("Junk after end of expression.");
  1834.  
  1835.   return expression_value;    /* set by yyparse () */
  1836. }
  1837.  
  1838. #ifdef TEST_EXP_READER
  1839. extern int yydebug;
  1840.  
  1841. /* Main program for testing purposes.  */
  1842. int
  1843. main ()
  1844. {
  1845.   int n, c;
  1846.   char buf[1024];
  1847.  
  1848. /*
  1849.   yydebug = 1;
  1850. */
  1851.   initialize_random_junk ();
  1852.  
  1853.   for (;;) {
  1854.     printf ("enter expression: ");
  1855.     n = 0;
  1856.     while ((buf[n] = getchar ()) != '\n' && buf[n] != EOF)
  1857.       n++;
  1858.     if (buf[n] == EOF)
  1859.       break;
  1860.     buf[n] = '\0';
  1861.     printf ("parser returned %d\n", parse_c_expression (buf));
  1862.   }
  1863.  
  1864.   return 0;
  1865. }
  1866.  
  1867. /* table to tell if char can be part of a C identifier. */
  1868. unsigned char is_idchar[256];
  1869. /* table to tell if char can be first char of a c identifier. */
  1870. unsigned char is_idstart[256];
  1871. /* table to tell if c is horizontal space.  isspace () thinks that
  1872.    newline is space; this is not a good idea for this program. */
  1873. char is_hor_space[256];
  1874.  
  1875. /*
  1876.  * initialize random junk in the hash table and maybe other places
  1877.  */
  1878. initialize_random_junk ()
  1879. {
  1880.   register int i;
  1881.  
  1882.   /*
  1883.    * Set up is_idchar and is_idstart tables.  These should be
  1884.    * faster than saying (is_alpha (c) || c == '_'), etc.
  1885.    * Must do set up these things before calling any routines tthat
  1886.    * refer to them.
  1887.    */
  1888.   for (i = 'a'; i <= 'z'; i++) {
  1889.     ++is_idchar[i - 'a' + 'A'];
  1890.     ++is_idchar[i];
  1891.     ++is_idstart[i - 'a' + 'A'];
  1892.     ++is_idstart[i];
  1893.   }
  1894.   for (i = '0'; i <= '9'; i++)
  1895.     ++is_idchar[i];
  1896.   ++is_idchar['_'];
  1897.   ++is_idstart['_'];
  1898. #if DOLLARS_IN_IDENTIFIERS
  1899.   ++is_idchar['$'];
  1900.   ++is_idstart['$'];
  1901. #endif
  1902.  
  1903.   /* horizontal space table */
  1904.   ++is_hor_space[' '];
  1905.   ++is_hor_space['\t'];
  1906. }
  1907.  
  1908. error (msg)
  1909. {
  1910.   printf ("error: %s\n", msg);
  1911. }
  1912.  
  1913. warning (msg)
  1914. {
  1915.   printf ("warning: %s\n", msg);
  1916. }
  1917.  
  1918. struct hashnode *
  1919. lookup (name, len, hash)
  1920.      char *name;
  1921.      int len;
  1922.      int hash;
  1923. {
  1924.   return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
  1925. }
  1926. #endif
  1927.